﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace websoniBO
{
    public class Gallery
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _gid = -99;
        private long _alid = -99;
        private string _images = "";
        private string _image_description = "";
        private bool _isdeleted = false;
        public long gid
        {
            get
            {
                return _gid;
            }
            set
            {
                _gid = value;
            }
        }
        public long alid
        {
            get
            {
                return _alid;
            }
            set
            {
                _alid = value;
            }
        }
        public string images
        {
            get
            {
                return _images;
            }
            set
            {
                _images= value;
            }
        }
        public string image_description
        {
            get
            {
                return _image_description;
            }
            set
            {
                _image_description = value;
            }
        }
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@gid", gid, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@alid", alid, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@images", images, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@image_description",image_description , DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2,dbparam3,dbparam4 };
                return DAC.Save("gallery_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long gid,long alid, string images,string image_description, bool isdeleted, string paraandor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@gid", gid, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@alid", alid, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@images", images, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@image_description", image_description, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@paraandor", paraandor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1,dbparam2, dbparam3, dbparam4 ,dbparam5};
                DataTable dt1 = DAC.Select("gallery_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}
